﻿var FirstProject = File('C:\\Users\\DongDong\\Desktop\\新建文件夹\\Flash Liyan\\flash.aep');
var outPath = 'C:\\Users\\DongDong\\Desktop\\新建文件夹\\Flash Liyan';
app.open(FirstProject);
var itemArray = new Array();
for(var i=0; i<app.project.items.length; i++){
          itemArray.push(app.project.items[i+1]);
    }
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);

for(var i=0; i<itemArray.length; i++){
        app.open(FirstProject);
        if(app.project.items[i+1].typeName == '合成'){
                var kArray = new Array();
                kArray.push(app.project.items[i+1]);
                app.project.reduceProject(kArray);
                var outFile = File(outPath + '\\' + kArray[0].name + '.aep');
                app.project.save(outFile);
                app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
            }else{
                app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
                }
        
    }


